package com.app.toknow.Common;

import android.app.Activity;
import android.app.ProgressDialog;
import android.widget.Toast;

import com.app.toknow.View.CustomProgressDialog;

public class PrintAlertUtil
{
    public static CustomProgressDialog showProgressDialog(Activity context,String strContent)
    {
        if (context != null)
        {
            CustomProgressDialog infoDialog = new CustomProgressDialog(context, strContent);// 创建自定义样式dialog
            infoDialog.setCancelable(false);// 不可以用“返回键”取消
            infoDialog.show();
            return infoDialog;
        }
        return null;
    }
    public static ProgressDialog showDialog(Activity context,String strContent,int max)
    {
        if (context != null)
        {
            ProgressDialog dialog = new ProgressDialog(context);
            dialog.setMessage(strContent);
            //设置风格为条状
            dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            //设置最大值
            dialog.setMax(max);
            //设置初始值
            dialog.setProgress(0);
            dialog.show();
            return dialog;
        }
        return null;
    }
    
    /**
     * @param infoDialog
     */
    public static void dismissProgressDialog(CustomProgressDialog infoDialog)
    {
        if (infoDialog != null)
        {
            infoDialog.dismiss();
        }
        infoDialog = null;
    }
    
    public static void showToast(Activity ac ,String content)
    {
        Toast.makeText(ac, content, Toast.LENGTH_SHORT).show();
    }
}
